using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace ParticleSystem.Particles
{
    public class RandomBurstParticleEmitter
    {
        ParticleSystem particleSystem;
        Vector3 position;
        Vector3 normal;
        Random random = new Random();

        public RandomBurstParticleEmitter(ParticleSystem particleSystem, Vector3 position, Vector3 normal)
        {
            this.particleSystem = particleSystem;
            this.position = position;
            this.normal = normal;
        }

        public void Update(GameTime gameTime)
        {
            if (random.Next(1, 1000) % 19 == 0)
            {
                AddBurst();
            }
        }

        void AddBurst()
        {
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
            particleSystem.AddParticle(position, normal * random.Next(1, 4));
        }
    }
}
